package com.mryin.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.mryin.pojo.User;
import com.mryin.mapper.UserMapper;
import com.mryin.service.UserService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author MRYIN
 * @since 2021-02-25
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 通过用户名查找
     * @param loginname
     * @return
     */
    @Override
    public User queryUserByLoginName(String loginname) {
        QueryWrapper<User> queryWrapper = new QueryWrapper();
        QueryWrapper<User> username = queryWrapper.eq("username", loginname);
        return userMapper.selectOne(username);
    }
}
